﻿using System;

namespace WP7.Extensions.Extensions
{
    public static class IntExtensions
    {
        /// <summary>
        /// Returns boolean if value is between minimum and maximum
        /// </summary>
        /// <param name="self">Your value</param>
        /// <param name="minimum">minvalue to chack against</param>
        /// <param name="maximum">maxvalue to chack against</param>
        /// <returns>True if value is between minimum and maximum</returns>
        public static bool IsWithin(this int self, int minimum, int maximum)
        {
            if (minimum > maximum)
                throw new ArgumentException("minimum must be of less value than maximum.");
            return self >= minimum && self <= maximum;
        }
    }
}
